package flc.ast.adapter;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.bean.StkResBean;
import stark.common.bean.StkResourceBean;

public class HotAdapter extends StkProviderMultiAdapter<StkResBean> {

    public HotAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(205));
        addItemProvider(new HotProvider());
    }

    private class HotProvider extends BaseItemProvider<StkResBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_hot;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, StkResBean bean) {
            Glide.with(getContext()).load(bean.getThumbUrl())
                    .into((ImageView) baseViewHolder.getView(R.id.ivHotItemImg));
            baseViewHolder.setText(R.id.tvHotItemName, bean.getName());
            baseViewHolder.setText(R.id.tvHotItemDesc,bean.getDesc());
        }
    }

}
